﻿using System;
namespace Producers.Etoimik.Xtee.Riik.Ee.Producer.Etoimik {
    
    
    [global::Xtee.Core.Attributes.XmlTypeAttribute(Name="Objekt", Namespace="http://producers.etoimik.xtee.riik.ee/producer/etoimik", Target=typeof(Objekt))]
    public class ObjektSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
        
        protected IObjekt clazz;
        
        public ObjektSerializer(IObjekt clazz) {
            this.clazz = clazz;
        }
        
        public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
            base.WriteXml(Writer);
            if (clazz.ObjektID!=null) {
                Writer.WriteStartElement("ObjektID");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "long");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdLong(((long)(clazz.ObjektID))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.Number!=null) {
                Writer.WriteStartElement("Number");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Number))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.AlgusKP!=null) {
                Writer.WriteStartElement("AlgusKP");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "dateTime");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdDateTime(((System.DateTime)(clazz.AlgusKP))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.Aadress!=null) {
                Writer.WriteStartElement("Aadress");
                global::Xtee.Core.SerializationMetadata metaAadress = this.GetMetaData(clazz.Aadress);
                Writer.WriteTypeAttribute(metaAadress.TypeQualifiedName.Namespace, metaAadress.TypeQualifiedName.Name);
                metaAadress.NewSerializer(clazz.Aadress).WriteXml(Writer);
                Writer.WriteEndElement();
            }
            if (clazz.TyypKL!=null) {
                Writer.WriteStartElement("TyypKL");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "long");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdLong(((long)(clazz.TyypKL))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.Kirjeldus!=null) {
                Writer.WriteStartElement("Kirjeldus");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Kirjeldus))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.Kogus!=null) {
                Writer.WriteStartElement("Kogus");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "decimal");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdDecimal(((decimal)(clazz.Kogus))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.YhikKL!=null) {
                Writer.WriteStartElement("YhikKL");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "long");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdLong(((long)(clazz.YhikKL))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.RahaVaartus!=null) {
                Writer.WriteStartElement("RahaVaartus");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "decimal");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdDecimal(((decimal)(clazz.RahaVaartus))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.ValuutaKL!=null) {
                Writer.WriteStartElement("ValuutaKL");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "long");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdLong(((long)(clazz.ValuutaKL))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.PakendiNR!=null) {
                Writer.WriteStartElement("PakendiNR");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.PakendiNR))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.Muutja!=null) {
                Writer.WriteStartElement("Muutja");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Muutja))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.MuutmiseKP!=null) {
                Writer.WriteStartElement("MuutmiseKP");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "dateTime");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdDateTime(((System.DateTime)(clazz.MuutmiseKP))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.Nimetus!=null) {
                Writer.WriteStartElement("Nimetus");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Nimetus))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.Failid!=null) {
                Writer.WriteStartElement("Failid");
                Writer.WriteTypeAttribute("http://schemas.xmlsoap.org/soap/encoding/", "Array");
                Writer.WriteArrayTypeAttribute("Fail", "http://producers.etoimik.xtee.riik.ee/producer/etoimik", clazz.Failid.Count);
                for (int x = 0; ((clazz.Failid != null) 
                            && (x < clazz.Failid.Count)); x = (x + 1)) {
                    if (clazz.Failid[x]!=null) {
                        Writer.WriteStartElement("item");
                        global::Xtee.Core.SerializationMetadata metaFailid = this.GetMetaData(clazz.Failid[x]);
                        Writer.WriteTypeAttribute(metaFailid.TypeQualifiedName.Namespace, metaFailid.TypeQualifiedName.Name);
                        metaFailid.NewSerializer(clazz.Failid[x]).WriteXml(Writer);
                        Writer.WriteEndElement();
                    }
                }
                Writer.WriteEndElement();
            }
            if (clazz.SeisundKL!=null) {
                Writer.WriteStartElement("SeisundKL");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "long");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdLong(((long)(clazz.SeisundKL))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.Sisestaja!=null) {
                Writer.WriteStartElement("Sisestaja");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Sisestaja))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.SisestamiseKP!=null) {
                Writer.WriteStartElement("SisestamiseKP");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "dateTime");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdDateTime(((System.DateTime)(clazz.SisestamiseKP))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.Sulgeja!=null) {
                Writer.WriteStartElement("Sulgeja");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Sulgeja))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.SulgemiseKP!=null) {
                Writer.WriteStartElement("SulgemiseKP");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "dateTime");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdDateTime(((System.DateTime)(clazz.SulgemiseKP))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.LiigidKL!=null) {
                Writer.WriteStartElement("LiigidKL");
                Writer.WriteTypeAttribute("http://schemas.xmlsoap.org/soap/encoding/", "Array");
                Writer.WriteArrayTypeAttribute("long", "http://www.w3.org/2001/XMLSchema", clazz.LiigidKL.Count);
                for (int x = 0; ((clazz.LiigidKL != null) 
                            && (x < clazz.LiigidKL.Count)); x = (x + 1)) {
                    if (clazz.LiigidKL[x]!=null) {
                        Writer.WriteStartElement("item");
                        Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "long");
                        Writer.WriteString(new global::Xtee.Core.Schema.XsdLong(((long)(clazz.LiigidKL[x]))).ToString());
                        Writer.WriteEndElement();
                    }
                }
                Writer.WriteEndElement();
            }
            if (clazz.AlaLiigidKL!=null) {
                Writer.WriteStartElement("AlaLiigidKL");
                Writer.WriteTypeAttribute("http://schemas.xmlsoap.org/soap/encoding/", "Array");
                Writer.WriteArrayTypeAttribute("long", "http://www.w3.org/2001/XMLSchema", clazz.AlaLiigidKL.Count);
                for (int x = 0; ((clazz.AlaLiigidKL != null) 
                            && (x < clazz.AlaLiigidKL.Count)); x = (x + 1)) {
                    if (clazz.AlaLiigidKL[x]!=null) {
                        Writer.WriteStartElement("item");
                        Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "long");
                        Writer.WriteString(new global::Xtee.Core.Schema.XsdLong(((long)(clazz.AlaLiigidKL[x]))).ToString());
                        Writer.WriteEndElement();
                    }
                }
                Writer.WriteEndElement();
            }
            if (clazz.StaatusedKL!=null) {
                Writer.WriteStartElement("StaatusedKL");
                Writer.WriteTypeAttribute("http://schemas.xmlsoap.org/soap/encoding/", "Array");
                Writer.WriteArrayTypeAttribute("long", "http://www.w3.org/2001/XMLSchema", clazz.StaatusedKL.Count);
                for (int x = 0; ((clazz.StaatusedKL != null) 
                            && (x < clazz.StaatusedKL.Count)); x = (x + 1)) {
                    if (clazz.StaatusedKL[x]!=null) {
                        Writer.WriteStartElement("item");
                        Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "long");
                        Writer.WriteString(new global::Xtee.Core.Schema.XsdLong(((long)(clazz.StaatusedKL[x]))).ToString());
                        Writer.WriteEndElement();
                    }
                }
                Writer.WriteEndElement();
            }
            if (clazz.AlaStaatusedKL!=null) {
                Writer.WriteStartElement("AlaStaatusedKL");
                Writer.WriteTypeAttribute("http://schemas.xmlsoap.org/soap/encoding/", "Array");
                Writer.WriteArrayTypeAttribute("long", "http://www.w3.org/2001/XMLSchema", clazz.AlaStaatusedKL.Count);
                for (int x = 0; ((clazz.AlaStaatusedKL != null) 
                            && (x < clazz.AlaStaatusedKL.Count)); x = (x + 1)) {
                    if (clazz.AlaStaatusedKL[x]!=null) {
                        Writer.WriteStartElement("item");
                        Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "long");
                        Writer.WriteString(new global::Xtee.Core.Schema.XsdLong(((long)(clazz.AlaStaatusedKL[x]))).ToString());
                        Writer.WriteEndElement();
                    }
                }
                Writer.WriteEndElement();
            }
            if (clazz.PakendiLiikKL!=null) {
                Writer.WriteStartElement("PakendiLiikKL");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "long");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdLong(((long)(clazz.PakendiLiikKL))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.Toimingud!=null) {
                Writer.WriteStartElement("Toimingud");
                Writer.WriteTypeAttribute("http://schemas.xmlsoap.org/soap/encoding/", "Array");
                Writer.WriteArrayTypeAttribute("Toiming", "http://producers.etoimik.xtee.riik.ee/producer/etoimik", clazz.Toimingud.Count);
                for (int x = 0; ((clazz.Toimingud != null) 
                            && (x < clazz.Toimingud.Count)); x = (x + 1)) {
                    if (clazz.Toimingud[x]!=null) {
                        Writer.WriteStartElement("item");
                        global::Xtee.Core.SerializationMetadata metaToimingud = this.GetMetaData(clazz.Toimingud[x]);
                        Writer.WriteTypeAttribute(metaToimingud.TypeQualifiedName.Namespace, metaToimingud.TypeQualifiedName.Name);
                        metaToimingud.NewSerializer(clazz.Toimingud[x]).WriteXml(Writer);
                        Writer.WriteEndElement();
                    }
                }
                Writer.WriteEndElement();
            }
            if (clazz.KlientsysteemiID!=null) {
                Writer.WriteStartElement("KlientsysteemiID");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.KlientsysteemiID))).ToString());
                Writer.WriteEndElement();
            }
        }
        
        public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
            base.ReadXml(Reader);
            if (Reader.LocalName=="ObjektID") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>Objekt>ObjektID");
                }
                clazz.ObjektID = new global::Xtee.Core.Schema.XsdLong(Reader.ReadElementString("ObjektID")).Value;
            }
            if (Reader.LocalName=="Number") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.Number = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Number")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="AlgusKP") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.AlgusKP = new global::Xtee.Core.Schema.XsdDateTime(Reader.ReadElementString("AlgusKP")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="Aadress") {
                if ((Reader.IsElementNil() == false)) {
                    global::Xtee.Core.SerializationMetadata metaAadress = this.GetMetaData<global::Producers.Etoimik.Xtee.Riik.Ee.Producer.Etoimik.IAadress>(Reader, "Aadress", "http://producers.etoimik.xtee.riik.ee/producer/etoimik");
                    clazz.Aadress = metaAadress.NewEntity<global::Producers.Etoimik.Xtee.Riik.Ee.Producer.Etoimik.IAadress>();
                    if ((Reader.IsEmptyElement == false)) {
                        Reader.ReadStartElement("Aadress");
                        metaAadress.NewSerializer(clazz.Aadress).ReadXml(Reader);
                        Reader.ReadEndElement();
                    }
                    else {
                        Reader.Skip();
                    }
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="TyypKL") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.TyypKL = new global::Xtee.Core.Schema.XsdLong(Reader.ReadElementString("TyypKL")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="Kirjeldus") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.Kirjeldus = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Kirjeldus")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="Kogus") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.Kogus = new global::Xtee.Core.Schema.XsdDecimal(Reader.ReadElementString("Kogus")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="YhikKL") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.YhikKL = new global::Xtee.Core.Schema.XsdLong(Reader.ReadElementString("YhikKL")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="RahaVaartus") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.RahaVaartus = new global::Xtee.Core.Schema.XsdDecimal(Reader.ReadElementString("RahaVaartus")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="ValuutaKL") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>Objekt>ValuutaKL");
                }
                clazz.ValuutaKL = new global::Xtee.Core.Schema.XsdLong(Reader.ReadElementString("ValuutaKL")).Value;
            }
            if (Reader.LocalName=="PakendiNR") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.PakendiNR = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("PakendiNR")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="Muutja") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.Muutja = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Muutja")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="MuutmiseKP") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.MuutmiseKP = new global::Xtee.Core.Schema.XsdDateTime(Reader.ReadElementString("MuutmiseKP")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="Nimetus") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.Nimetus = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Nimetus")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="Failid") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.Failid = new System.Collections.Generic.List<global::Producers.Etoimik.Xtee.Riik.Ee.Producer.Etoimik.IFail>();
                    if ((Reader.IsEmptyElement == false)) {
                        Reader.ReadStartElement("Failid");
                        for (; ((Reader.NodeType != System.Xml.XmlNodeType.EndElement) 
                                    && (Reader.LocalName == "item")); ) {
                            if ((Reader.IsElementNil() == false)) {
                                global::Xtee.Core.SerializationMetadata metaFailid = this.GetMetaData<global::Producers.Etoimik.Xtee.Riik.Ee.Producer.Etoimik.IFail>(Reader, "Fail", "http://producers.etoimik.xtee.riik.ee/producer/etoimik");
                                global::Producers.Etoimik.Xtee.Riik.Ee.Producer.Etoimik.IFail item = metaFailid.NewEntity<global::Producers.Etoimik.Xtee.Riik.Ee.Producer.Etoimik.IFail>();
                                clazz.Failid.Add(item);
                                if ((Reader.IsEmptyElement == false)) {
                                    Reader.ReadStartElement("item");
                                    metaFailid.NewSerializer(item).ReadXml(Reader);
                                    Reader.ReadEndElement();
                                }
                                else {
                                    Reader.Skip();
                                }
                            }
                            else {
                                clazz.Failid.Add(null);
                                Reader.Skip();
                            }
                        }
                        Reader.ReadEndElement();
                    }
                    else {
                        Reader.Skip();
                    }
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="SeisundKL") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.SeisundKL = new global::Xtee.Core.Schema.XsdLong(Reader.ReadElementString("SeisundKL")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="Sisestaja") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.Sisestaja = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Sisestaja")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="SisestamiseKP") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.SisestamiseKP = new global::Xtee.Core.Schema.XsdDateTime(Reader.ReadElementString("SisestamiseKP")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="Sulgeja") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.Sulgeja = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Sulgeja")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="SulgemiseKP") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.SulgemiseKP = new global::Xtee.Core.Schema.XsdDateTime(Reader.ReadElementString("SulgemiseKP")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="LiigidKL") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.LiigidKL = new System.Collections.Generic.List<System.Int64?>();
                    if ((Reader.IsEmptyElement == false)) {
                        Reader.ReadStartElement("LiigidKL");
                        for (; ((Reader.NodeType != System.Xml.XmlNodeType.EndElement) 
                                    && (Reader.LocalName == "item")); ) {
                            if (Reader.IsElementNil()) {
                                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>Objekt>LiigidKL>item");
                            }
                            clazz.LiigidKL.Add(new global::Xtee.Core.Schema.XsdLong(Reader.ReadElementString("item")).Value);
                        }
                        Reader.ReadEndElement();
                    }
                    else {
                        Reader.Skip();
                    }
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="AlaLiigidKL") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.AlaLiigidKL = new System.Collections.Generic.List<System.Int64?>();
                    if ((Reader.IsEmptyElement == false)) {
                        Reader.ReadStartElement("AlaLiigidKL");
                        for (; ((Reader.NodeType != System.Xml.XmlNodeType.EndElement) 
                                    && (Reader.LocalName == "item")); ) {
                            if (Reader.IsElementNil()) {
                                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>Objekt>AlaLiigidKL>item");
                            }
                            clazz.AlaLiigidKL.Add(new global::Xtee.Core.Schema.XsdLong(Reader.ReadElementString("item")).Value);
                        }
                        Reader.ReadEndElement();
                    }
                    else {
                        Reader.Skip();
                    }
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="StaatusedKL") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.StaatusedKL = new System.Collections.Generic.List<System.Int64?>();
                    if ((Reader.IsEmptyElement == false)) {
                        Reader.ReadStartElement("StaatusedKL");
                        for (; ((Reader.NodeType != System.Xml.XmlNodeType.EndElement) 
                                    && (Reader.LocalName == "item")); ) {
                            if (Reader.IsElementNil()) {
                                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>Objekt>StaatusedKL>item");
                            }
                            clazz.StaatusedKL.Add(new global::Xtee.Core.Schema.XsdLong(Reader.ReadElementString("item")).Value);
                        }
                        Reader.ReadEndElement();
                    }
                    else {
                        Reader.Skip();
                    }
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="AlaStaatusedKL") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.AlaStaatusedKL = new System.Collections.Generic.List<System.Int64?>();
                    if ((Reader.IsEmptyElement == false)) {
                        Reader.ReadStartElement("AlaStaatusedKL");
                        for (; ((Reader.NodeType != System.Xml.XmlNodeType.EndElement) 
                                    && (Reader.LocalName == "item")); ) {
                            if (Reader.IsElementNil()) {
                                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>Objekt>AlaStaatusedKL>item");
                            }
                            clazz.AlaStaatusedKL.Add(new global::Xtee.Core.Schema.XsdLong(Reader.ReadElementString("item")).Value);
                        }
                        Reader.ReadEndElement();
                    }
                    else {
                        Reader.Skip();
                    }
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="PakendiLiikKL") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.PakendiLiikKL = new global::Xtee.Core.Schema.XsdLong(Reader.ReadElementString("PakendiLiikKL")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="Toimingud") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.Toimingud = new System.Collections.Generic.List<global::Producers.Etoimik.Xtee.Riik.Ee.Producer.Etoimik.IToiming>();
                    if ((Reader.IsEmptyElement == false)) {
                        Reader.ReadStartElement("Toimingud");
                        for (; ((Reader.NodeType != System.Xml.XmlNodeType.EndElement) 
                                    && (Reader.LocalName == "item")); ) {
                            if ((Reader.IsElementNil() == false)) {
                                global::Xtee.Core.SerializationMetadata metaToimingud = this.GetMetaData<global::Producers.Etoimik.Xtee.Riik.Ee.Producer.Etoimik.IToiming>(Reader, "Toiming", "http://producers.etoimik.xtee.riik.ee/producer/etoimik");
                                global::Producers.Etoimik.Xtee.Riik.Ee.Producer.Etoimik.IToiming item = metaToimingud.NewEntity<global::Producers.Etoimik.Xtee.Riik.Ee.Producer.Etoimik.IToiming>();
                                clazz.Toimingud.Add(item);
                                if ((Reader.IsEmptyElement == false)) {
                                    Reader.ReadStartElement("item");
                                    metaToimingud.NewSerializer(item).ReadXml(Reader);
                                    Reader.ReadEndElement();
                                }
                                else {
                                    Reader.Skip();
                                }
                            }
                            else {
                                clazz.Toimingud.Add(null);
                                Reader.Skip();
                            }
                        }
                        Reader.ReadEndElement();
                    }
                    else {
                        Reader.Skip();
                    }
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="KlientsysteemiID") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.KlientsysteemiID = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("KlientsysteemiID")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
        }
    }
}
